package com.maxmlr.concurrent.cyclic;

import java.util.Collection;

/**
 * @ClassName MainThread
 * @Description 主线程处理
 * @Author maxiao
 * @Date 2020/3/5 下午3:11
 * @Version V1.0
 */
public class MainThread implements Runnable {

    public int count;

    long time;

    public MainThread(int count){
        this.count=count;
        time=System.currentTimeMillis();
    }

    @Override
    public void run() {
        boolean flag=true;
        Collection<Producer> values = TestCyclic.map.values();
        for (Producer producer:values){
            if (!producer.flag()){
                flag=producer.flag();
            }
            System.out.println(producer.flag()+"---"+producer.msg);
        }
        if (flag){
            System.out.println("处理成功;"+(System.currentTimeMillis()-time));
        }else {
            System.out.println("处理失败;"+(System.currentTimeMillis()-time));
        }
    }
}
